home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / mail / mailleds.93 / mailleds / mailleds-0.93 / port.h < prev    next >
C/C++ Source or Header  |  1996-02-14  |  887b  |  36 lines

  1. /*-----------------------------------------------------------------------------
  2.  * port.h 
  3.  * Low level I/O functions taken from led-stat.txt
  4.  * Jan 22 95
  5.  */
  6.  
  7. /*
  8.  Two files were used: the first is a routine written by a roomate
  9.  (damianf@wpi.edu) used to blast raw bytes at a port, and read them. Please
  10.  contact him for more info, or if you want to use it in a progrm of your own.
  11.  */
  12.  
  13. #ifndef PORT_H
  14. #define PORT_H
  15.  
  16. static inline int port_in( int port )
  17. {
  18.   unsigned char value;
  19.   __asm__ volatile ("inb %1,%0"
  20.                     : "=a" (value)
  21.                     : "d" ((unsigned short)port));
  22.   return value;
  23. }
  24.  
  25. static inline void port_out( unsigned short int port, unsigned char val )
  26. {
  27.   __asm__ volatile (
  28.                     "outb %0,%1\n"
  29.                     :
  30.                     : "a" (val), "d" (port)
  31.                     );
  32. }
  33. #endif /* PORT_H */
  34. /**** END OF FILE ****/
  35.  
  36.